package com.sxygsj.android.personnelscreen.services.webserver;


import android.content.Context;
import com.yanzhenjie.andserver.annotation.Config;
import com.yanzhenjie.andserver.framework.config.Multipart;
import com.yanzhenjie.andserver.framework.config.WebConfig;
import com.yanzhenjie.andserver.framework.website.AssetsWebsite;

import java.io.File;

@Config
public class AppConfig implements WebConfig {

    @Override
    public void onConfig(Context context, Delegate delegate) {
        delegate.addWebsite(new AssetsWebsite(context, "/web"));
        delegate.setMultipart(Multipart.newBuilder()
                // 200M 这里是设置客户端上传的文件大小
                .allFileMaxSize(1024 * 1024 * 200)
                // 200M
                .fileMaxSize(1024 * 1024 * 200)
                // 1024 * 10 bytes
                .maxInMemorySize(1024 * 10)
                .uploadTempDir(new File(context.getCacheDir(), "_server_upload_cache_"))
                .build());
    }
}
